package o;

import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;

public class dll {
    private static dll ˊ;
    private static boolean ˎ = false;

    private dll() {
    }

    public static synchronized dll ˎ() {
        dll o_dll;
        synchronized (dll.class) {
            if (ˊ == null) {
                ˊ = new dll();
                ˎ = dli.ˎ(ContentManager.getInstant().getContext(), "com.ironsource.appcloud.oobe.huawei");
            }
            o_dll = ˊ;
        }
        return o_dll;
    }

    private static boolean ˏ(Context context, ComponentName componentName, int i) {
        PackageManager packageManager = context.getPackageManager();
        if (packageManager == null) {
            return false;
        }
        int componentEnabledSetting = packageManager.getComponentEnabledSetting(componentName);
        if (componentEnabledSetting == 0) {
            if (1 == i) {
                return true;
            }
            return false;
        } else if (1 != componentEnabledSetting) {
            return false;
        } else {
            return true;
        }
    }

    public ComponentName ˋ() {
        return new ComponentName("com.ironsource.appcloud.oobe.huawei", "com.ironsource.appmanager.ui.activities.HuaweiPrimaryWizardActivity");
    }

    public boolean ˊ(Context context) {
        try {
            return ˏ(context, ˋ(), 1);
        } catch (Exception e) {
            Logger.e("OOBE", "AuraMediator.isPrimaryFlowReady exception:" + e.getMessage());
            return false;
        }
    }

    public boolean ˊ(Activity activity, dln o_dln, int i) {
        if (ˊ(activity)) {
            Intent intent = new Intent();
            intent.setComponent(ˋ());
            if (o_dln != null) {
                intent.putExtra("channelInfo", o_dln.ॱ());
                intent.putStringArrayListExtra("simOperatorInfo", o_dln.ˏ());
                intent.putExtra("isOpenChannel", o_dln.ˎ());
            }
            try {
                activity.startActivityForResult(intent, i);
                dli.ˏ("350302", dli.ʽ(activity.getBaseContext()));
                Logger.ˎ("OOBE", "Aura.startPrimaryFlowActivityForResult");
            } catch (ActivityNotFoundException e) {
                Logger.e("OOBE", "startPrimaryFlowActivityForResult ActivityNotFoundException");
            } catch (Exception e2) {
                Logger.e("OOBE", "startPrimaryFlowActivityForResult exception:" + e2.getMessage());
            }
        } else {
            Logger.ˎ("OOBE", "Aura.startPrimaryFlowActivityForResult: component not ready");
        }
        return false;
    }

    public void ˏ(Context context) {
        if (ˎ) {
            Intent intent = new Intent("com.ironsource.aura.oobe.BROADCAST_PRIMARY_FLOW_SKIPPED");
            intent.addFlags(32);
            intent.setPackage("com.ironsource.appcloud.oobe.huawei");
            context.sendBroadcast(intent);
            Logger.ˎ("OOBE", "Aura.notifyPrimaryFlowSkipped");
        }
    }

    public void ˋ(Context context, boolean z) {
        if (ˎ) {
            Intent intent = new Intent("com.ironsource.aura.oobe.SETUP_WIZARD_FINISHED");
            intent.addFlags(32);
            intent.setPackage("com.ironsource.appcloud.oobe.huawei");
            intent.putExtra("secondaryFlowNeedBroadcast", z);
            context.sendBroadcast(intent);
            dli.ˏ("350303", dli.ʽ(context));
            Logger.ˎ("OOBE", "Aura.notifySetupWizardCompleted");
        }
    }

    public void ˏ(Context context, dln o_dln) {
        Intent intent = new Intent("com.ironsource.aura.oobe.COTA_READY_FOR_SECONDARY_FLOW");
        intent.addFlags(32);
        intent.setPackage("com.ironsource.appcloud.oobe.huawei");
        if (o_dln != null) {
            intent.putExtra("channelInfo", o_dln.ॱ());
            intent.putStringArrayListExtra("simOperatorInfo", o_dln.ˏ());
            intent.putExtra("isOpenChannel", o_dln.ˎ());
        }
        context.sendBroadcast(intent, "com.ironsource.aura.permission.SEND_SETUP_WIZARD_EVENTS");
        dli.ˏ("350305", dli.ʽ(context));
        Logger.ˎ("OOBE", "Aura.notifyCotaReadyForSecondaryFlow");
    }

    public void ˋ(Context context) {
        if (ˎ) {
            Intent intent = new Intent();
            intent.addFlags(32);
            intent.setPackage("com.ironsource.appcloud.oobe.huawei");
            intent.setAction("com.ironsource.aura.ACTION_CONNECTIVITY");
            context.sendBroadcast(intent, "com.ironsource.aura.permission.SEND_SETUP_WIZARD_EVENTS");
            dli.ˏ("350301", dli.ʽ(context));
            Logger.ˎ("OOBE", "Aura.notifyFirstNetworkConnectivity");
        }
    }
}
